package com.genexususa.eo.bing.data.wsSubclasses;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.BusinessTargetBid;
import com.genexususa.eo.bing.CampaignManagementServiceClasses.IncrementalBidPercentage;
import org.w3c.dom.Element;

public class GxBusinessTargetBid extends BusinessTargetBid {
    public GxBusinessTargetBid(Element element) {
        if (element.getElementsByTagName("BusinessId").getLength() > 0 &&
            element.getElementsByTagName("BusinessId").item(0).getChildNodes().getLength() > 0) {
            this.setBusinessId(Long.valueOf(element.getElementsByTagName("BusinessId").item(0).getChildNodes().item(0).getNodeValue()));
        }
        if (element.getElementsByTagName("IncrementalBid").getLength() > 0 &&
            element.getElementsByTagName("IncrementalBid").item(0).getChildNodes().getLength() > 0) {
            this.setIncrementalBid(IncrementalBidPercentage.fromString(element.getElementsByTagName("IncrementalBid").item(0).getChildNodes().item(0).getNodeValue()));
        }
        if (element.getElementsByTagName("Radius").getLength() > 0 &&
            element.getElementsByTagName("Radius").item(0).getChildNodes().getLength() > 0) {
            this.setRadius(Integer.valueOf(element.getElementsByTagName("Radius").item(0).getChildNodes().item(0).getNodeValue()));
        }
    }
}
